package com.zmm.type.dao;

import com.zmm.type.model.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description:
 * @Name CategoryDao
 * @Author Zebulon
 * @Date By 2021-06-27 16:53:15
 */
@Mapper
public interface CategoryDao {

    /**
     * 新增分类
     * @description:
     * @author: Zebulon
     * @date: 2021-06-27 16:58:19
     * @param category: 
     * @return: java.lang.Integer
     **/
    Integer insertCategory(Category category);

    /**
     * 根据分类ID 查询 分类
     * @description:
     * @author: Zebulon
     * @date: 2021-06-27 16:58:54
     * @param categoryId:
     * @return: com.zmm.type.model.Category
     **/
    Category findCategoryById(Integer categoryId);

    /**
     * 根据 categoryType 查询全部分类
     * @author: 900045
     * @date: 2021-06-28 16:20:56
     * @throws 
     * @param categoryType: 
	 * @param show:
	 * @param status:   
     * @return: java.util.List<com.zmm.type.model.Category>
     **/
	List<Category> findAllCategory(@Param("categoryType") Integer categoryType, @Param("status") Integer status, @Param("show") Integer show);

	/**
	 * 根据 父ID(也是categoryId) 查询 Category
	 * @author: 900045
	 * @date: 2021-07-05 15:32:05
	 * @throws 
	 * @param categoryId: 
	 * @return: com.zmm.type.model.Category
	 **/
	Category selectCategoryByParentId(@Param("categoryId") Integer categoryId);

	/**
	 * 判断同一级类目下是否存在同名类目
	 * @author: 900045
	 * @date: 2021-07-05 15:39:49
	 * @throws 
	 * @param category: 
	 * @return: java.lang.Integer
	 **/
	Integer isExistName(Category category);

	/**
	 * 更新类目
	 * @author: 900045
	 * @date: 2021-07-05 16:17:09
	 * @throws 
	 * @param category: 
	 * @return: java.lang.Integer
	 **/
	Integer updateCategory(Category category);

	/**
	 * 根据一级类目修改所有子级类目的名称
	 * @author: 900045
	 * @date: 2021-07-05 16:26:11
	 * @throws 
	 * @param category: 
	 * @return: void
	 **/
	void updateSubCateNameForFirst(Category category);

	/**
	 * 根据二级类目修改所有三级类目引用的名称
	 * @author: 900045
	 * @date: 2021-07-05 16:26:14
	 * @throws 
	 * @param category: 
	 * @return: void
	 **/
	void updateSubCateNameForSecond(Category category);

	/**
	 * 查一级类目下的二级类目
	 * @author: 900045
	 * @date: 2021-07-05 16:37:08
	 * @throws 
	 * @param cate: 
	 * @return: java.lang.Integer
	 **/
	Integer selectCategoryByFirstId(Category cate);

	/**
	 * 查二级类目下的三级类目
	 * @author: 900045
	 * @date: 2021-07-05 16:39:31
	 * @throws 
	 * @param cate: 
	 * @return: java.util.List<com.zmm.type.model.Category>
	 **/
	List<Category> selectCategoryBySecondId(Category cate);

	/**
	 * 查找前台类目所关联的商品个数
	 * @author: 900045
	 * @date: 2021-07-05 16:42:25
	 * @throws 
	 * @param categoryId: 
	 * @return: java.lang.Integer
	 **/
	Integer selectFrontGoodsNumByCategoryId(Integer categoryId);

	/**
	 * 查找后台三级类目下商品个数
	 * @author: 900045
	 * @date: 2021-07-05 16:44:08
	 * @throws 
	 * @param categoryId: 
	 * @return: java.lang.Integer
	 **/
	Integer selectGoodsNumByCategoryId(Integer categoryId);

	/**
	 * 根据类型查找类目值(categoryType)列表
	 * @author: 900045
	 * @date: 2021-07-05 16:53:40
	 * @throws 
	 * @param categoryType: 
	 * @return: java.util.List<com.zmm.type.model.Category>
	 **/
	List<Category> selectAllCategoryByCategoryType(@Param("categoryType") Integer categoryType);

	/**
	 * 查二级类目下的三级类目
	 * @author: 900045
	 * @date: 2021-07-05 17:10:26
	 * @throws 
	 * @param category: 
	 * @return: java.util.List<com.zmm.type.model.Category>
	 **/
	List<Category> selectThreeCategoryBySecondCategoryId(Category category);
}
